﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Master/InSite.Master" CodeBehind="BillManager.aspx.vb" Inherits="Core.BillManager" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<style type="text/css" media="all">
		@import url(/static/inSite/css/redmond.datepick.css);
		.datepick-trigger{cursor:pointer;margin-bottom: -5px;}
</style>
<script src="/static/inSite/js/jquery.datepick.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $('#ctl00_ContentPlaceHolder1_txtStartDate').datepick({ showOnFocus: false, showTrigger: '<img src="/static/inSite/images/date.png" alt="..."></img>' });
        $('#ctl00_ContentPlaceHolder1_txtEndDate').datepick({ showOnFocus: false, showTrigger: '<img src="/static/inSite/images/date.png" alt="..."></img>' });
    });
    //#ctl00_ContentPlaceHolder1_txtIdBill
    
    function formatNum(num) {
        num = num.toString().replace(/\$|\,/g, '');
        if (isNaN(num))
            num = "";
        return num;
    }
</script>
<script language="javascript" type="text/javascript">
    $("#clickme").click(function () {
        $("#searchForm").show("slow");
        //$("div").show("fast");
    });

    $("#spanHide").click(function () {
        $("#searchForm").hide(1000);
    });
    function showF() {
        $("#fieldForm").css("width", "700px");
        $("#fieldForm").css("padding", "15px");
        $("#fieldForm").css("border", "1px solid #0095FD");

        $("#searchForm").show("slow");
        $("#spanShow").hide(1000);
        $("#spanHide").show("fast");
    }

    function hideF() {
        $("#searchForm").hide(1000);
        $("#spanHide").hide(1000);
        $("#spanShow").show("fast");

        $("#fieldForm").css("width", "0px");
        $("#fieldForm").css("padding", "0px");
        $("#fieldForm").css("border", "none");
    }
</script>

<fieldset style="width:0px;margin: 0 auto;padding:0px;border:none;margin-left: 80px;" id="fieldForm">
    <legend>
        <img src="/static/inSite/images/edit_add.png" id="spanShow" onclick="showF();" style="cursor:pointer;" />
        <img src="/static/inSite/images/edit_remove.png" id="spanHide" style="display:none;cursor:pointer;" onclick="hideF();" />
    </legend>
    <div id="searchForm" style="display:none;">
        <table width="100%">
            <tr>
                <td>
                    <table width="100%">
                        <tr>
                            <td style="width:110px; color: #666666;">
                                Tên khách hàng:
                            </td>
                            <td>
                                <asp:TextBox ID="txtName" class="mediumfield" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td style="width:110px; color: #666666;">
                                Email:
                            </td>
                            <td>
                                <asp:TextBox ID="txtEmail" class="mediumfield" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td style="width:110px; color: #666666;">
                                Địa chỉ:
                            </td>
                            <td>
                                <asp:TextBox ID="txtAddress" class="mediumfield" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td style="width:110px; color: #666666;">
                                Số điện thoại:
                            </td>
                            <td>
                                <asp:TextBox ID="txtPhone" class="mediumfield" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td style="width:125px; color: #666666;">
                                Trạng thái đơn hàng:
                            </td>
                            <td>
                                <asp:DropDownList ID="cbxStatus" runat="server" CssClass="centerCbx" Width="218px"></asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td>
                                
                            </td>
                        </tr>
                    </table>
                </td>
                <td>
                    <table width="100%" style="margin-left: 30px;">
                        <tr>
                            <td style="width:110px; color: #666666;">
                                Từ ngày:
                            </td>
                            <td>
                                <asp:TextBox ID="txtStartDate" class="smallfield" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td style="width:110px; color: #666666;">
                                Đến ngày:
                            </td>
                            <td>
                                <asp:TextBox ID="txtEndDate" class="smallfield" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td style="width:110px; color: #666666;color:Red;">
                                Mã đơn hàng:
                            </td>
                            <td>
                                <asp:TextBox ID="txtIdBill" class="smallfield" runat="server" onBlur="this.value=formatNum(this.value);" ></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td style="width:110px; color: #666666;">
                                
                            </td>
                            <td>
                                
                            </td>
                        </tr>
                        <tr>
                            <td style="width:125px; color: #666666;">
                    
                            </td>
                            <td>
                    
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td>
                    
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                <asp:Button ID="btnSearch" runat="server" Text="Tìm kiếm" class="button" Height="26px" style="float: none;"/>
                </td>
            </tr>
        </table>
        
    </div>
</fieldset>
<br />
<fieldset>
    <legend>Danh sách đơn hàng</legend>
    <table width="100%" style="margin-bottom:10px;margin-top: -20px;">
        <tr>
            <td style="width:110px; color: #666666;text-align:right;">Tổng giá trị các đơn hàng: <asp:Label ID="lblTotal" runat="server" Text="" CssClass="lblTotal"></asp:Label></td>
        </tr>
    </table>
    <asp:SqlDataSource ID="dsSource" runat="server"></asp:SqlDataSource>
    <asp:GridView ID="grid2" runat="server" class="tblMain" DataSourceID="dsSource"
            AutoGenerateColumns="false" GridLines="None" AllowPaging="true" DataKeyNames="BillID" PageSize="10" AllowSorting="True"
            HeaderStyle-BackColor="#9097a9"> 
            <Columns>
                <asp:TemplateField HeaderText="No.">
                    <ItemTemplate>
                        <asp:Label Visible="false" runat="server" ID="lbl_ID" Text='<%#Eval("BillID") %>'></asp:Label>
                        <asp:Label Visible="false" runat="server" ID="lbl_Name" Text='<%#Eval("BillName") %>'></asp:Label>
                        <asp:Label Visible="false" runat="server" ID="lblSubCatID" Text='<%#Eval("CusID") %>'></asp:Label>
                        <asp:Label Visible="true" runat="server" ID="lblNo" Text='<%#Container.DataItemIndex + 1 %>'></asp:Label>
                        <asp:Label Visible="false" runat="server" ID="lbStt" Text='<%#Eval("BillStatus") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle Width="30px" HorizontalAlign="Left" ForeColor="Black" />
                    <ItemStyle Width="30px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Mã số">
                    <ItemTemplate>
                        <asp:Label Visible="true" runat="server" ID="lbl_ID" Text='<%#Eval("BillID") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle Width="30px" HorizontalAlign="Left" ForeColor="Black" />
                    <ItemStyle Width="30px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Tên khách hàng" SortExpression="BillName">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblBillName" Text='<%#Eval("BillName") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle Width="150" HorizontalAlign="Left" />
                    <ItemStyle Width="150" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Địa chỉ" SortExpression="BillAddress">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblBillAddress" Text='<%#Eval("BillAddress") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Left" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Số điện thoại" SortExpression="BillPhone">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblBillPhone" Text='<%#Eval("BillPhone") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle Width="100" HorizontalAlign="Left" />
                    <ItemStyle Width="100" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Ngày đặt" SortExpression="BillDate">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblBillDate" Text='<%#formatTime(Eval("BillDate")) %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle Width="110" HorizontalAlign="Left" />
                    <ItemStyle Width="110" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Tổng tiền" SortExpression="BillTotal">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblBillTotal" Text='<%#formatCurrency(Eval("BillTotal")) %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle Width="100" HorizontalAlign="center" />
                    <ItemStyle Width="100" HorizontalAlign="Right" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Trạng thái" SortExpression="BillStatus">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblBillStatus" Text='<%#formatStatus(Eval("BillStatus")) %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle Width="100" HorizontalAlign="Center" />
                    <ItemStyle Width="100" HorizontalAlign="Center"/>
                </asp:TemplateField>
            </Columns>
        <PagerStyle HorizontalAlign="Center" />
    </asp:GridView>
</fieldset>

</asp:Content>
